package com.example.denist.adapter;

import com.example.denist.R;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class ImageAdapter extends BaseAdapter {
	
	Context context;
	private static Integer[] imageIDs = {
			R.drawable.one,
			R.drawable.two,
			R.drawable.three,
			R.drawable.four};
	
	public ImageAdapter(Context context) {
		this.context = context;
	}
	
	
	@Override
	public int getCount() {
		return Integer.MAX_VALUE;
	}

	@Override
	public Object getItem(int position) {
		return imageIDs[position % imageIDs.length];
	}

	@Override
	public long getItemId(int position) {
		return position;
	}
	
	public static Integer[] getImageIDs() {
		return imageIDs;
	}


	public static void setImageIDs(Integer[] imageIDs) {
		ImageAdapter.imageIDs = imageIDs;
	}


	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ImageView imageView = new ImageView(context);
		imageView.setImageResource(imageIDs[position%imageIDs.length]);
		imageView.setScaleType(ImageView.ScaleType.FIT_XY);
		return imageView;
	}
}
